Left Termination of the query pattern times_in_3(g, g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

even(0, true).
even(s(0), false).
even(s(s(X)), B) :- even(X, B).
half(0, 0).
half(s(s(X)), s(Y)) :- half(X, Y).
plus(0, Y, Y).
plus(s(X), Y, s(Z)) :- plus(X, Y, Z).
times(0, Y, 0).
times(s(X), Y, Z) :- ','(even(s(X), B), if(B, s(X), Y, Z)).
if(true, s(X), Y, Z) :- ','(half(s(X), X1), ','(times(X1, Y, Y1), plus(Y1, Y1, Z))).
if(false, s(X), Y, Z) :- ','(times(X, Y, U), plus(Y, U, Z)).

Queries:

times(g,g,a).

We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

times_in(s(X), Y, Z) → U4(X, Y, Z, even_in(s(X), B))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
even_in(0, true) → even_out(0, true)
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
U4(X, Y, Z, even_out(s(X), B)) → U5(X, Y, Z, if_in(B, s(X), Y, Z))
if_in(false, s(X), Y, Z) → U9(X, Y, Z, times_in(X, Y, U))
times_in(0, Y, 0) → times_out(0, Y, 0)
U9(X, Y, Z, times_out(X, Y, U)) → U10(X, Y, Z, plus_in(Y, U, Z))
plus_in(s(X), Y, s(Z)) → U3(X, Y, Z, plus_in(X, Y, Z))
plus_in(0, Y, Y) → plus_out(0, Y, Y)
U3(X, Y, Z, plus_out(X, Y, Z)) → plus_out(s(X), Y, s(Z))
U10(X, Y, Z, plus_out(Y, U, Z)) → if_out(false, s(X), Y, Z)
if_in(true, s(X), Y, Z) → U6(X, Y, Z, half_in(s(X), X1))
half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
half_in(0, 0) → half_out(0, 0)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U6(X, Y, Z, half_out(s(X), X1)) → U7(X, Y, Z, times_in(X1, Y, Y1))
U7(X, Y, Z, times_out(X1, Y, Y1)) → U8(X, Y, Z, plus_in(Y1, Y1, Z))
U8(X, Y, Z, plus_out(Y1, Y1, Z)) → if_out(true, s(X), Y, Z)
U5(X, Y, Z, if_out(B, s(X), Y, Z)) → times_out(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
times_in(x1, x2, x3)  =  times_in(x1, x2)
s(x1)  =  s(x1)
U4(x1, x2, x3, x4)  =  U4(x1, x2, x4)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
U5(x1, x2, x3, x4)  =  U5(x4)
if_in(x1, x2, x3, x4)  =  if_in(x1, x2, x3)
U9(x1, x2, x3, x4)  =  U9(x2, x4)
times_out(x1, x2, x3)  =  times_out(x3)
U10(x1, x2, x3, x4)  =  U10(x4)
plus_in(x1, x2, x3)  =  plus_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x4)
plus_out(x1, x2, x3)  =  plus_out(x3)
if_out(x1, x2, x3, x4)  =  if_out(x4)
U6(x1, x2, x3, x4)  =  U6(x2, x4)
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
U7(x1, x2, x3, x4)  =  U7(x4)
U8(x1, x2, x3, x4)  =  U8(x4)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

times_in(s(X), Y, Z) → U4(X, Y, Z, even_in(s(X), B))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
even_in(0, true) → even_out(0, true)
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
U4(X, Y, Z, even_out(s(X), B)) → U5(X, Y, Z, if_in(B, s(X), Y, Z))
if_in(false, s(X), Y, Z) → U9(X, Y, Z, times_in(X, Y, U))
times_in(0, Y, 0) → times_out(0, Y, 0)
U9(X, Y, Z, times_out(X, Y, U)) → U10(X, Y, Z, plus_in(Y, U, Z))
plus_in(s(X), Y, s(Z)) → U3(X, Y, Z, plus_in(X, Y, Z))
plus_in(0, Y, Y) → plus_out(0, Y, Y)
U3(X, Y, Z, plus_out(X, Y, Z)) → plus_out(s(X), Y, s(Z))
U10(X, Y, Z, plus_out(Y, U, Z)) → if_out(false, s(X), Y, Z)
if_in(true, s(X), Y, Z) → U6(X, Y, Z, half_in(s(X), X1))
half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
half_in(0, 0) → half_out(0, 0)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U6(X, Y, Z, half_out(s(X), X1)) → U7(X, Y, Z, times_in(X1, Y, Y1))
U7(X, Y, Z, times_out(X1, Y, Y1)) → U8(X, Y, Z, plus_in(Y1, Y1, Z))
U8(X, Y, Z, plus_out(Y1, Y1, Z)) → if_out(true, s(X), Y, Z)
U5(X, Y, Z, if_out(B, s(X), Y, Z)) → times_out(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
times_in(x1, x2, x3)  =  times_in(x1, x2)
s(x1)  =  s(x1)
U4(x1, x2, x3, x4)  =  U4(x1, x2, x4)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
U5(x1, x2, x3, x4)  =  U5(x4)
if_in(x1, x2, x3, x4)  =  if_in(x1, x2, x3)
U9(x1, x2, x3, x4)  =  U9(x2, x4)
times_out(x1, x2, x3)  =  times_out(x3)
U10(x1, x2, x3, x4)  =  U10(x4)
plus_in(x1, x2, x3)  =  plus_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x4)
plus_out(x1, x2, x3)  =  plus_out(x3)
if_out(x1, x2, x3, x4)  =  if_out(x4)
U6(x1, x2, x3, x4)  =  U6(x2, x4)
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
U7(x1, x2, x3, x4)  =  U7(x4)
U8(x1, x2, x3, x4)  =  U8(x4)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

TIMES_IN(s(X), Y, Z) → U41(X, Y, Z, even_in(s(X), B))
TIMES_IN(s(X), Y, Z) → EVEN_IN(s(X), B)
EVEN_IN(s(s(X)), B) → U11(X, B, even_in(X, B))
EVEN_IN(s(s(X)), B) → EVEN_IN(X, B)
U41(X, Y, Z, even_out(s(X), B)) → U51(X, Y, Z, if_in(B, s(X), Y, Z))
U41(X, Y, Z, even_out(s(X), B)) → IF_IN(B, s(X), Y, Z)
IF_IN(false, s(X), Y, Z) → U91(X, Y, Z, times_in(X, Y, U))
IF_IN(false, s(X), Y, Z) → TIMES_IN(X, Y, U)
U91(X, Y, Z, times_out(X, Y, U)) → U101(X, Y, Z, plus_in(Y, U, Z))
U91(X, Y, Z, times_out(X, Y, U)) → PLUS_IN(Y, U, Z)
PLUS_IN(s(X), Y, s(Z)) → U31(X, Y, Z, plus_in(X, Y, Z))
PLUS_IN(s(X), Y, s(Z)) → PLUS_IN(X, Y, Z)
IF_IN(true, s(X), Y, Z) → U61(X, Y, Z, half_in(s(X), X1))
IF_IN(true, s(X), Y, Z) → HALF_IN(s(X), X1)
HALF_IN(s(s(X)), s(Y)) → U21(X, Y, half_in(X, Y))
HALF_IN(s(s(X)), s(Y)) → HALF_IN(X, Y)
U61(X, Y, Z, half_out(s(X), X1)) → U71(X, Y, Z, times_in(X1, Y, Y1))
U61(X, Y, Z, half_out(s(X), X1)) → TIMES_IN(X1, Y, Y1)
U71(X, Y, Z, times_out(X1, Y, Y1)) → U81(X, Y, Z, plus_in(Y1, Y1, Z))
U71(X, Y, Z, times_out(X1, Y, Y1)) → PLUS_IN(Y1, Y1, Z)

The TRS R consists of the following rules:

times_in(s(X), Y, Z) → U4(X, Y, Z, even_in(s(X), B))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
even_in(0, true) → even_out(0, true)
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
U4(X, Y, Z, even_out(s(X), B)) → U5(X, Y, Z, if_in(B, s(X), Y, Z))
if_in(false, s(X), Y, Z) → U9(X, Y, Z, times_in(X, Y, U))
times_in(0, Y, 0) → times_out(0, Y, 0)
U9(X, Y, Z, times_out(X, Y, U)) → U10(X, Y, Z, plus_in(Y, U, Z))
plus_in(s(X), Y, s(Z)) → U3(X, Y, Z, plus_in(X, Y, Z))
plus_in(0, Y, Y) → plus_out(0, Y, Y)
U3(X, Y, Z, plus_out(X, Y, Z)) → plus_out(s(X), Y, s(Z))
U10(X, Y, Z, plus_out(Y, U, Z)) → if_out(false, s(X), Y, Z)
if_in(true, s(X), Y, Z) → U6(X, Y, Z, half_in(s(X), X1))
half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
half_in(0, 0) → half_out(0, 0)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U6(X, Y, Z, half_out(s(X), X1)) → U7(X, Y, Z, times_in(X1, Y, Y1))
U7(X, Y, Z, times_out(X1, Y, Y1)) → U8(X, Y, Z, plus_in(Y1, Y1, Z))
U8(X, Y, Z, plus_out(Y1, Y1, Z)) → if_out(true, s(X), Y, Z)
U5(X, Y, Z, if_out(B, s(X), Y, Z)) → times_out(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
times_in(x1, x2, x3)  =  times_in(x1, x2)
s(x1)  =  s(x1)
U4(x1, x2, x3, x4)  =  U4(x1, x2, x4)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
U5(x1, x2, x3, x4)  =  U5(x4)
if_in(x1, x2, x3, x4)  =  if_in(x1, x2, x3)
U9(x1, x2, x3, x4)  =  U9(x2, x4)
times_out(x1, x2, x3)  =  times_out(x3)
U10(x1, x2, x3, x4)  =  U10(x4)
plus_in(x1, x2, x3)  =  plus_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x4)
plus_out(x1, x2, x3)  =  plus_out(x3)
if_out(x1, x2, x3, x4)  =  if_out(x4)
U6(x1, x2, x3, x4)  =  U6(x2, x4)
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
U7(x1, x2, x3, x4)  =  U7(x4)
U8(x1, x2, x3, x4)  =  U8(x4)
EVEN_IN(x1, x2)  =  EVEN_IN(x1)
U101(x1, x2, x3, x4)  =  U101(x4)
TIMES_IN(x1, x2, x3)  =  TIMES_IN(x1, x2)
U41(x1, x2, x3, x4)  =  U41(x1, x2, x4)
IF_IN(x1, x2, x3, x4)  =  IF_IN(x1, x2, x3)
PLUS_IN(x1, x2, x3)  =  PLUS_IN(x1, x2)
U71(x1, x2, x3, x4)  =  U71(x4)
U11(x1, x2, x3)  =  U11(x3)
U51(x1, x2, x3, x4)  =  U51(x4)
U31(x1, x2, x3, x4)  =  U31(x4)
HALF_IN(x1, x2)  =  HALF_IN(x1)
U81(x1, x2, x3, x4)  =  U81(x4)
U91(x1, x2, x3, x4)  =  U91(x2, x4)
U61(x1, x2, x3, x4)  =  U61(x2, x4)
U21(x1, x2, x3)  =  U21(x3)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

TIMES_IN(s(X), Y, Z) → U41(X, Y, Z, even_in(s(X), B))
TIMES_IN(s(X), Y, Z) → EVEN_IN(s(X), B)
EVEN_IN(s(s(X)), B) → U11(X, B, even_in(X, B))
EVEN_IN(s(s(X)), B) → EVEN_IN(X, B)
U41(X, Y, Z, even_out(s(X), B)) → U51(X, Y, Z, if_in(B, s(X), Y, Z))
U41(X, Y, Z, even_out(s(X), B)) → IF_IN(B, s(X), Y, Z)
IF_IN(false, s(X), Y, Z) → U91(X, Y, Z, times_in(X, Y, U))
IF_IN(false, s(X), Y, Z) → TIMES_IN(X, Y, U)
U91(X, Y, Z, times_out(X, Y, U)) → U101(X, Y, Z, plus_in(Y, U, Z))
U91(X, Y, Z, times_out(X, Y, U)) → PLUS_IN(Y, U, Z)
PLUS_IN(s(X), Y, s(Z)) → U31(X, Y, Z, plus_in(X, Y, Z))
PLUS_IN(s(X), Y, s(Z)) → PLUS_IN(X, Y, Z)
IF_IN(true, s(X), Y, Z) → U61(X, Y, Z, half_in(s(X), X1))
IF_IN(true, s(X), Y, Z) → HALF_IN(s(X), X1)
HALF_IN(s(s(X)), s(Y)) → U21(X, Y, half_in(X, Y))
HALF_IN(s(s(X)), s(Y)) → HALF_IN(X, Y)
U61(X, Y, Z, half_out(s(X), X1)) → U71(X, Y, Z, times_in(X1, Y, Y1))
U61(X, Y, Z, half_out(s(X), X1)) → TIMES_IN(X1, Y, Y1)
U71(X, Y, Z, times_out(X1, Y, Y1)) → U81(X, Y, Z, plus_in(Y1, Y1, Z))
U71(X, Y, Z, times_out(X1, Y, Y1)) → PLUS_IN(Y1, Y1, Z)

The TRS R consists of the following rules:

times_in(s(X), Y, Z) → U4(X, Y, Z, even_in(s(X), B))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
even_in(0, true) → even_out(0, true)
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
U4(X, Y, Z, even_out(s(X), B)) → U5(X, Y, Z, if_in(B, s(X), Y, Z))
if_in(false, s(X), Y, Z) → U9(X, Y, Z, times_in(X, Y, U))
times_in(0, Y, 0) → times_out(0, Y, 0)
U9(X, Y, Z, times_out(X, Y, U)) → U10(X, Y, Z, plus_in(Y, U, Z))
plus_in(s(X), Y, s(Z)) → U3(X, Y, Z, plus_in(X, Y, Z))
plus_in(0, Y, Y) → plus_out(0, Y, Y)
U3(X, Y, Z, plus_out(X, Y, Z)) → plus_out(s(X), Y, s(Z))
U10(X, Y, Z, plus_out(Y, U, Z)) → if_out(false, s(X), Y, Z)
if_in(true, s(X), Y, Z) → U6(X, Y, Z, half_in(s(X), X1))
half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
half_in(0, 0) → half_out(0, 0)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U6(X, Y, Z, half_out(s(X), X1)) → U7(X, Y, Z, times_in(X1, Y, Y1))
U7(X, Y, Z, times_out(X1, Y, Y1)) → U8(X, Y, Z, plus_in(Y1, Y1, Z))
U8(X, Y, Z, plus_out(Y1, Y1, Z)) → if_out(true, s(X), Y, Z)
U5(X, Y, Z, if_out(B, s(X), Y, Z)) → times_out(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
times_in(x1, x2, x3)  =  times_in(x1, x2)
s(x1)  =  s(x1)
U4(x1, x2, x3, x4)  =  U4(x1, x2, x4)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
U5(x1, x2, x3, x4)  =  U5(x4)
if_in(x1, x2, x3, x4)  =  if_in(x1, x2, x3)
U9(x1, x2, x3, x4)  =  U9(x2, x4)
times_out(x1, x2, x3)  =  times_out(x3)
U10(x1, x2, x3, x4)  =  U10(x4)
plus_in(x1, x2, x3)  =  plus_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x4)
plus_out(x1, x2, x3)  =  plus_out(x3)
if_out(x1, x2, x3, x4)  =  if_out(x4)
U6(x1, x2, x3, x4)  =  U6(x2, x4)
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
U7(x1, x2, x3, x4)  =  U7(x4)
U8(x1, x2, x3, x4)  =  U8(x4)
EVEN_IN(x1, x2)  =  EVEN_IN(x1)
U101(x1, x2, x3, x4)  =  U101(x4)
TIMES_IN(x1, x2, x3)  =  TIMES_IN(x1, x2)
U41(x1, x2, x3, x4)  =  U41(x1, x2, x4)
IF_IN(x1, x2, x3, x4)  =  IF_IN(x1, x2, x3)
PLUS_IN(x1, x2, x3)  =  PLUS_IN(x1, x2)
U71(x1, x2, x3, x4)  =  U71(x4)
U11(x1, x2, x3)  =  U11(x3)
U51(x1, x2, x3, x4)  =  U51(x4)
U31(x1, x2, x3, x4)  =  U31(x4)
HALF_IN(x1, x2)  =  HALF_IN(x1)
U81(x1, x2, x3, x4)  =  U81(x4)
U91(x1, x2, x3, x4)  =  U91(x2, x4)
U61(x1, x2, x3, x4)  =  U61(x2, x4)
U21(x1, x2, x3)  =  U21(x3)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 4 SCCs with 12 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

HALF_IN(s(s(X)), s(Y)) → HALF_IN(X, Y)

The TRS R consists of the following rules:

times_in(s(X), Y, Z) → U4(X, Y, Z, even_in(s(X), B))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
even_in(0, true) → even_out(0, true)
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
U4(X, Y, Z, even_out(s(X), B)) → U5(X, Y, Z, if_in(B, s(X), Y, Z))
if_in(false, s(X), Y, Z) → U9(X, Y, Z, times_in(X, Y, U))
times_in(0, Y, 0) → times_out(0, Y, 0)
U9(X, Y, Z, times_out(X, Y, U)) → U10(X, Y, Z, plus_in(Y, U, Z))
plus_in(s(X), Y, s(Z)) → U3(X, Y, Z, plus_in(X, Y, Z))
plus_in(0, Y, Y) → plus_out(0, Y, Y)
U3(X, Y, Z, plus_out(X, Y, Z)) → plus_out(s(X), Y, s(Z))
U10(X, Y, Z, plus_out(Y, U, Z)) → if_out(false, s(X), Y, Z)
if_in(true, s(X), Y, Z) → U6(X, Y, Z, half_in(s(X), X1))
half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
half_in(0, 0) → half_out(0, 0)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U6(X, Y, Z, half_out(s(X), X1)) → U7(X, Y, Z, times_in(X1, Y, Y1))
U7(X, Y, Z, times_out(X1, Y, Y1)) → U8(X, Y, Z, plus_in(Y1, Y1, Z))
U8(X, Y, Z, plus_out(Y1, Y1, Z)) → if_out(true, s(X), Y, Z)
U5(X, Y, Z, if_out(B, s(X), Y, Z)) → times_out(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
times_in(x1, x2, x3)  =  times_in(x1, x2)
s(x1)  =  s(x1)
U4(x1, x2, x3, x4)  =  U4(x1, x2, x4)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
U5(x1, x2, x3, x4)  =  U5(x4)
if_in(x1, x2, x3, x4)  =  if_in(x1, x2, x3)
U9(x1, x2, x3, x4)  =  U9(x2, x4)
times_out(x1, x2, x3)  =  times_out(x3)
U10(x1, x2, x3, x4)  =  U10(x4)
plus_in(x1, x2, x3)  =  plus_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x4)
plus_out(x1, x2, x3)  =  plus_out(x3)
if_out(x1, x2, x3, x4)  =  if_out(x4)
U6(x1, x2, x3, x4)  =  U6(x2, x4)
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
U7(x1, x2, x3, x4)  =  U7(x4)
U8(x1, x2, x3, x4)  =  U8(x4)
HALF_IN(x1, x2)  =  HALF_IN(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

HALF_IN(s(s(X)), s(Y)) → HALF_IN(X, Y)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
HALF_IN(x1, x2)  =  HALF_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

HALF_IN(s(s(X))) → HALF_IN(X)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

PLUS_IN(s(X), Y, s(Z)) → PLUS_IN(X, Y, Z)

The TRS R consists of the following rules:

times_in(s(X), Y, Z) → U4(X, Y, Z, even_in(s(X), B))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
even_in(0, true) → even_out(0, true)
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
U4(X, Y, Z, even_out(s(X), B)) → U5(X, Y, Z, if_in(B, s(X), Y, Z))
if_in(false, s(X), Y, Z) → U9(X, Y, Z, times_in(X, Y, U))
times_in(0, Y, 0) → times_out(0, Y, 0)
U9(X, Y, Z, times_out(X, Y, U)) → U10(X, Y, Z, plus_in(Y, U, Z))
plus_in(s(X), Y, s(Z)) → U3(X, Y, Z, plus_in(X, Y, Z))
plus_in(0, Y, Y) → plus_out(0, Y, Y)
U3(X, Y, Z, plus_out(X, Y, Z)) → plus_out(s(X), Y, s(Z))
U10(X, Y, Z, plus_out(Y, U, Z)) → if_out(false, s(X), Y, Z)
if_in(true, s(X), Y, Z) → U6(X, Y, Z, half_in(s(X), X1))
half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
half_in(0, 0) → half_out(0, 0)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U6(X, Y, Z, half_out(s(X), X1)) → U7(X, Y, Z, times_in(X1, Y, Y1))
U7(X, Y, Z, times_out(X1, Y, Y1)) → U8(X, Y, Z, plus_in(Y1, Y1, Z))
U8(X, Y, Z, plus_out(Y1, Y1, Z)) → if_out(true, s(X), Y, Z)
U5(X, Y, Z, if_out(B, s(X), Y, Z)) → times_out(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
times_in(x1, x2, x3)  =  times_in(x1, x2)
s(x1)  =  s(x1)
U4(x1, x2, x3, x4)  =  U4(x1, x2, x4)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
U5(x1, x2, x3, x4)  =  U5(x4)
if_in(x1, x2, x3, x4)  =  if_in(x1, x2, x3)
U9(x1, x2, x3, x4)  =  U9(x2, x4)
times_out(x1, x2, x3)  =  times_out(x3)
U10(x1, x2, x3, x4)  =  U10(x4)
plus_in(x1, x2, x3)  =  plus_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x4)
plus_out(x1, x2, x3)  =  plus_out(x3)
if_out(x1, x2, x3, x4)  =  if_out(x4)
U6(x1, x2, x3, x4)  =  U6(x2, x4)
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
U7(x1, x2, x3, x4)  =  U7(x4)
U8(x1, x2, x3, x4)  =  U8(x4)
PLUS_IN(x1, x2, x3)  =  PLUS_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

PLUS_IN(s(X), Y, s(Z)) → PLUS_IN(X, Y, Z)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
PLUS_IN(x1, x2, x3)  =  PLUS_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

PLUS_IN(s(X), Y) → PLUS_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

EVEN_IN(s(s(X)), B) → EVEN_IN(X, B)

The TRS R consists of the following rules:

times_in(s(X), Y, Z) → U4(X, Y, Z, even_in(s(X), B))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
even_in(0, true) → even_out(0, true)
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
U4(X, Y, Z, even_out(s(X), B)) → U5(X, Y, Z, if_in(B, s(X), Y, Z))
if_in(false, s(X), Y, Z) → U9(X, Y, Z, times_in(X, Y, U))
times_in(0, Y, 0) → times_out(0, Y, 0)
U9(X, Y, Z, times_out(X, Y, U)) → U10(X, Y, Z, plus_in(Y, U, Z))
plus_in(s(X), Y, s(Z)) → U3(X, Y, Z, plus_in(X, Y, Z))
plus_in(0, Y, Y) → plus_out(0, Y, Y)
U3(X, Y, Z, plus_out(X, Y, Z)) → plus_out(s(X), Y, s(Z))
U10(X, Y, Z, plus_out(Y, U, Z)) → if_out(false, s(X), Y, Z)
if_in(true, s(X), Y, Z) → U6(X, Y, Z, half_in(s(X), X1))
half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
half_in(0, 0) → half_out(0, 0)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U6(X, Y, Z, half_out(s(X), X1)) → U7(X, Y, Z, times_in(X1, Y, Y1))
U7(X, Y, Z, times_out(X1, Y, Y1)) → U8(X, Y, Z, plus_in(Y1, Y1, Z))
U8(X, Y, Z, plus_out(Y1, Y1, Z)) → if_out(true, s(X), Y, Z)
U5(X, Y, Z, if_out(B, s(X), Y, Z)) → times_out(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
times_in(x1, x2, x3)  =  times_in(x1, x2)
s(x1)  =  s(x1)
U4(x1, x2, x3, x4)  =  U4(x1, x2, x4)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
U5(x1, x2, x3, x4)  =  U5(x4)
if_in(x1, x2, x3, x4)  =  if_in(x1, x2, x3)
U9(x1, x2, x3, x4)  =  U9(x2, x4)
times_out(x1, x2, x3)  =  times_out(x3)
U10(x1, x2, x3, x4)  =  U10(x4)
plus_in(x1, x2, x3)  =  plus_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x4)
plus_out(x1, x2, x3)  =  plus_out(x3)
if_out(x1, x2, x3, x4)  =  if_out(x4)
U6(x1, x2, x3, x4)  =  U6(x2, x4)
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
U7(x1, x2, x3, x4)  =  U7(x4)
U8(x1, x2, x3, x4)  =  U8(x4)
EVEN_IN(x1, x2)  =  EVEN_IN(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

EVEN_IN(s(s(X)), B) → EVEN_IN(X, B)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
EVEN_IN(x1, x2)  =  EVEN_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

EVEN_IN(s(s(X))) → EVEN_IN(X)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

IF_IN(false, s(X), Y, Z) → TIMES_IN(X, Y, U)
IF_IN(true, s(X), Y, Z) → U61(X, Y, Z, half_in(s(X), X1))
U41(X, Y, Z, even_out(s(X), B)) → IF_IN(B, s(X), Y, Z)
U61(X, Y, Z, half_out(s(X), X1)) → TIMES_IN(X1, Y, Y1)
TIMES_IN(s(X), Y, Z) → U41(X, Y, Z, even_in(s(X), B))

The TRS R consists of the following rules:

times_in(s(X), Y, Z) → U4(X, Y, Z, even_in(s(X), B))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
even_in(0, true) → even_out(0, true)
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
U4(X, Y, Z, even_out(s(X), B)) → U5(X, Y, Z, if_in(B, s(X), Y, Z))
if_in(false, s(X), Y, Z) → U9(X, Y, Z, times_in(X, Y, U))
times_in(0, Y, 0) → times_out(0, Y, 0)
U9(X, Y, Z, times_out(X, Y, U)) → U10(X, Y, Z, plus_in(Y, U, Z))
plus_in(s(X), Y, s(Z)) → U3(X, Y, Z, plus_in(X, Y, Z))
plus_in(0, Y, Y) → plus_out(0, Y, Y)
U3(X, Y, Z, plus_out(X, Y, Z)) → plus_out(s(X), Y, s(Z))
U10(X, Y, Z, plus_out(Y, U, Z)) → if_out(false, s(X), Y, Z)
if_in(true, s(X), Y, Z) → U6(X, Y, Z, half_in(s(X), X1))
half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
half_in(0, 0) → half_out(0, 0)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U6(X, Y, Z, half_out(s(X), X1)) → U7(X, Y, Z, times_in(X1, Y, Y1))
U7(X, Y, Z, times_out(X1, Y, Y1)) → U8(X, Y, Z, plus_in(Y1, Y1, Z))
U8(X, Y, Z, plus_out(Y1, Y1, Z)) → if_out(true, s(X), Y, Z)
U5(X, Y, Z, if_out(B, s(X), Y, Z)) → times_out(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
times_in(x1, x2, x3)  =  times_in(x1, x2)
s(x1)  =  s(x1)
U4(x1, x2, x3, x4)  =  U4(x1, x2, x4)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
U5(x1, x2, x3, x4)  =  U5(x4)
if_in(x1, x2, x3, x4)  =  if_in(x1, x2, x3)
U9(x1, x2, x3, x4)  =  U9(x2, x4)
times_out(x1, x2, x3)  =  times_out(x3)
U10(x1, x2, x3, x4)  =  U10(x4)
plus_in(x1, x2, x3)  =  plus_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x4)
plus_out(x1, x2, x3)  =  plus_out(x3)
if_out(x1, x2, x3, x4)  =  if_out(x4)
U6(x1, x2, x3, x4)  =  U6(x2, x4)
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
U7(x1, x2, x3, x4)  =  U7(x4)
U8(x1, x2, x3, x4)  =  U8(x4)
TIMES_IN(x1, x2, x3)  =  TIMES_IN(x1, x2)
U41(x1, x2, x3, x4)  =  U41(x1, x2, x4)
IF_IN(x1, x2, x3, x4)  =  IF_IN(x1, x2, x3)
U61(x1, x2, x3, x4)  =  U61(x2, x4)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

IF_IN(false, s(X), Y, Z) → TIMES_IN(X, Y, U)
IF_IN(true, s(X), Y, Z) → U61(X, Y, Z, half_in(s(X), X1))
U41(X, Y, Z, even_out(s(X), B)) → IF_IN(B, s(X), Y, Z)
U61(X, Y, Z, half_out(s(X), X1)) → TIMES_IN(X1, Y, Y1)
TIMES_IN(s(X), Y, Z) → U41(X, Y, Z, even_in(s(X), B))

The TRS R consists of the following rules:

half_in(s(s(X)), s(Y)) → U2(X, Y, half_in(X, Y))
even_in(s(s(X)), B) → U1(X, B, even_in(X, B))
even_in(s(0), false) → even_out(s(0), false)
U2(X, Y, half_out(X, Y)) → half_out(s(s(X)), s(Y))
U1(X, B, even_out(X, B)) → even_out(s(s(X)), B)
half_in(0, 0) → half_out(0, 0)
even_in(0, true) → even_out(0, true)

The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
even_in(x1, x2)  =  even_in(x1)
U1(x1, x2, x3)  =  U1(x3)
0  =  0
false  =  false
even_out(x1, x2)  =  even_out(x2)
true  =  true
half_in(x1, x2)  =  half_in(x1)
U2(x1, x2, x3)  =  U2(x3)
half_out(x1, x2)  =  half_out(x2)
TIMES_IN(x1, x2, x3)  =  TIMES_IN(x1, x2)
U41(x1, x2, x3, x4)  =  U41(x1, x2, x4)
IF_IN(x1, x2, x3, x4)  =  IF_IN(x1, x2, x3)
U61(x1, x2, x3, x4)  =  U61(x2, x4)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ RuleRemovalProof

Q DP problem:
The TRS P consists of the following rules:

U41(X, Y, even_out(B)) → IF_IN(B, s(X), Y)
U61(Y, half_out(X1)) → TIMES_IN(X1, Y)
IF_IN(false, s(X), Y) → TIMES_IN(X, Y)
IF_IN(true, s(X), Y) → U61(Y, half_in(s(X)))
TIMES_IN(s(X), Y) → U41(X, Y, even_in(s(X)))

The TRS R consists of the following rules:

half_in(s(s(X))) → U2(half_in(X))
even_in(s(s(X))) → U1(even_in(X))
even_in(s(0)) → even_out(false)
U2(half_out(Y)) → half_out(s(Y))
U1(even_out(B)) → even_out(B)
half_in(0) → half_out(0)
even_in(0) → even_out(true)

The set Q consists of the following terms:

half_in(x0)
even_in(x0)
U2(x0)
U1(x0)

We have to consider all (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

IF_IN(false, s(X), Y) → TIMES_IN(X, Y)

Strictly oriented rules of the TRS R:

half_in(s(s(X))) → U2(half_in(X))
even_in(s(s(X))) → U1(even_in(X))
even_in(s(0)) → even_out(false)

Used ordering: POLO with Polynomial interpretation [25]:

POL(0) = 0   
POL(IF_IN(x1, x2, x3)) = x1 + x2 + x3   
POL(TIMES_IN(x1, x2)) = 2·x1 + x2   
POL(U1(x1)) = 2·x1   
POL(U2(x1)) = 2 + 2·x1   
POL(U41(x1, x2, x3)) = 1 + 2·x1 + x2 + x3   
POL(U61(x1, x2)) = x1 + x2   
POL(even_in(x1)) = x1   
POL(even_out(x1)) = x1   
POL(false) = 0   
POL(half_in(x1)) = x1   
POL(half_out(x1)) = 2·x1   
POL(s(x1)) = 1 + 2·x1   
POL(true) = 0   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ RuleRemovalProof
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

U41(X, Y, even_out(B)) → IF_IN(B, s(X), Y)
U61(Y, half_out(X1)) → TIMES_IN(X1, Y)
IF_IN(true, s(X), Y) → U61(Y, half_in(s(X)))
TIMES_IN(s(X), Y) → U41(X, Y, even_in(s(X)))

The TRS R consists of the following rules:

U2(half_out(Y)) → half_out(s(Y))
U1(even_out(B)) → even_out(B)
half_in(0) → half_out(0)
even_in(0) → even_out(true)

The set Q consists of the following terms:

half_in(x0)
even_in(x0)
U2(x0)
U1(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 4 less nodes.